# 从你刚刚下载的包中导入 Celery 类
from celery import Celery
from django.conf import settings

# 在创建celery实例之前，把Django的配置模块加载到运行环境中
import os
if not os.getenv('DJANGO_SETTINGS_MODULE'):
    os.environ['DJANGO_SETTINGS_MODULE'] = 'ihome_team7.settings.dev'

# 利用导入的 Celery 创建对象

celery_app = Celery('i_home7')
celery_app.conf.broker_url = settings.CELERY_REDIS



# 注册异步任务 之前忘记注册
# celery_app.autodiscover_tasks(['celery_tasks.sendmessage','celery_tasks.sendemail','celery_tasks.goodshtml'])